package org.nanotek.lucene;

import java.util.Date;

import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.LongField;
import org.apache.lucene.document.TextField;

public class TextDocumentBuilder implements LuceneDocumentBuilder<String> {

	private String textFieldName = "TextData";
	
	@Override
	public Document buildDocument(String source) {
		Document document = new Document();
		Field wordField = new TextField(textFieldName, source, Field.Store.YES); 
		document.add(wordField);
		Field modifiedField = new LongField("modified" , new Date().getTime() , Field.Store.YES); 
		document.add(modifiedField);
		return document;
	}

	public String getTextFieldName() {
		return textFieldName;
	}

	public void setTextFieldName(String textFieldName) {
		this.textFieldName = textFieldName;
	}

}
